﻿<controls:ChildWindow 
	x:Class="MVVMtutorialAdvanced.AuthorDetails"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
	xmlns:MVVMSL="clr-namespace:Riba.MVVMSL;assembly=RibaMVVMSL"
	xmlns:ControlsToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
	Style="{StaticResource ChildWindowStyle}"
	Width="300" Height="200" 
	Title="Autor"
	DataContext="{Binding Source={StaticResource App_ViewModelLocator}, Converter={StaticResource App_ViewModelNameToViewModelConverter}, ConverterParameter=MVVMtutorialAdvanced.AuthorDetails_VM}"
>
	<Grid Margin="2">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<MVVMSL:ViewEventHandlerControl />

		<StackPanel Grid.Row="0">
			<ContentControl HorizontalContentAlignment="Stretch">
				<StackPanel Orientation="Vertical">
					<ControlsToolkit:DataField LabelStyle="{StaticResource LabelStyle}">
						<TextBlock Text="{Binding CurrentEntity.Id, Mode=TwoWay}" />
					</ControlsToolkit:DataField>
					<ControlsToolkit:DataField LabelStyle="{StaticResource LabelStyle}">
						<TextBox Text="{Binding CurrentEntity.FirstName, Mode=TwoWay}" />
					</ControlsToolkit:DataField>
					<ControlsToolkit:DataField LabelStyle="{StaticResource LabelStyle}">
						<TextBox Text="{Binding CurrentEntity.LastName, Mode=TwoWay}" />
					</ControlsToolkit:DataField>
				</StackPanel>
			</ContentControl>
			</StackPanel>

		<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
			<Button
				x:Name="CancelButton" Content="Cancel"
				Click="CancelButton_Click"
				Width="60" Margin="0, 0, 2, 0"
			/>
			<Button
				x:Name="OkButton" Content="OK"
				Command="{Binding CommandOk, Mode=OneWay}"
				Width="60"
			/>
		</StackPanel>
	</Grid>
</controls:ChildWindow>